/*
  according pointcloud output mode to publish different combination of
  pointcloud channel mode could be 1. normal, namely fusion for perception, top
  for ndt, surround for aeb
  2. calibration, only output channels for calibration
  3. other mode according to utilizations
*/
#ifndef _LIDAR_MOTION_PUBLISHER_H_
#define _LIDAR_MOTION_PUBLISHER_H_

#include "data_type.h"
#include "cyber/cyber.h"
#include "modules/drivers/lidar/livox/proto/publish_config.pb.h"

namespace apollo {
namespace drivers {
namespace livox {

using apollo::cyber::Node;
using apollo::cyber::Writer;
using apollo::drivers::livox::WriterConfig;
using apollo::drivers::livox::PublisherConfig;

class WriterWrapper {
 public:
  bool Init(const WriterConfig config, const std::shared_ptr<Node> node);
  void Write(const std::shared_ptr<MixLidarFrame> frame);

 private:
  WriterConfig config_;
  std::shared_ptr<Node> node_ = nullptr;
  std::shared_ptr<Writer<Cloud>> writer_ = nullptr;
};

class Publisher {
 public:
  bool Init(std::shared_ptr<Node> node);
  void Publish(const std::shared_ptr<MixLidarFrame> frame);

 private:
  PublisherConfig config_;
  std::vector<std::shared_ptr<WriterWrapper>> writer_list_;
};

}  // namespace livox
}  // namespace drivers
}  // namespace apollo
#endif
